import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DickYang
 * Date: 2023-06-21
 * Time: 12:33
 */
public class Test {
    //轮转数组
    public static void rotate(int[] nums, int k) {
        int n = nums.length;
        int[] arr = new int[n];

        for (int i = 0; i < n; ++i) {
            arr[(i + k) % n] = nums[i];
        }
        System.arraycopy(arr,0,nums,0,n);
    }

    //消失的数字
    //先求0-n的和,最后减去sum(nums)
    public static int missingNumber(int[] nums) {
        int len = nums.length;
        int sum = len * (len + 1) / 2;  //计算0-n的和
        for (int i = 0; i < len; i++) {
            sum = sum - nums[i];
        }
        return sum;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int[] nums = {1,2,3,4,5,6,7};
        int k = scanner.nextInt();
        rotate(nums,k);
        System.out.println(Arrays.toString(nums));


    }
    public static void main1(String[] args) {
        int[] tmp = {9,6,4,2,3,5,7,0,1};
        int p = missingNumber(tmp);
        System.out.println(p);
    }
}
